﻿<%@ Page Language="C#" MasterPageFile="~/Admin/AdminMasterPage.Master" AutoEventWireup="true" CodeFile="DonDatHang.aspx.cs" Inherits="Admin_DonDatHang" Title="Don Dat Hang" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        <h3>Danh sách đơn đặt hàng</h3>	    
    <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" 
            DataKeyNames="IDDonDatHang">
      
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="itemPlaceholderContainer" runat="server" border="1" 
                            class="table_ds_loai_tl">
                            <tr runat="server">
                                <th runat="server">
                                    Mã</th>
                                <th runat="server">
                                    Tên khách hàng</th>
                                <th runat="server">
                                    Thời điểm đặt hàng</th>
                                <th runat="server">
                                    Tổng tiền</th>
                                <th runat="server">
                                    Trạng thái</th>
                                <th runat="server" style="width:20px;">
                                    </th>
                            </tr>
                            <tr ID="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" >
                        <asp:DataPager ID="DataPager1" runat="server">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <InsertItemTemplate>
            <tr style="">
                <td>
                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                        Text="Insert" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Clear" />
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    <asp:TextBox ID="IDUserTextBox" runat="server" 
                        Text='<%# Bind("IDUser") %>' />
                </td>
                <td>
                    <asp:TextBox ID="ThoiDiemLapDDHTextBox" runat="server" 
                        Text='<%# Bind("ThoiDiemLapDDH") %>' />
                </td>
                <td>
                    <asp:TextBox ID="TongTienTextBox" runat="server" 
                        Text='<%# Bind("TongTien") %>' />
                </td>
                <td>
                    <asp:TextBox ID="TrangThaiTextBox" runat="server" 
                        Text='<%# Bind("TrangThai") %>' />
                </td>
            </tr>
        </InsertItemTemplate>
        <SelectedItemTemplate>
            <tr style="background-color: #E2DED6;font-weight: bold;color: #333333;">
                <td>
                    <asp:Label ID="IDDonDatHangLabel" runat="server" 
                        Text='<%# Eval("IDDonDatHang") %>' />
                </td>
                <td>
                    <asp:Label ID="IDUserLabel" runat="server" 
                        Text='<%# Eval("IDUser") %>' />
                </td>
                <td>
                    <asp:Label ID="ThoiDiemLapDDHLabel" runat="server" 
                        Text='<%# Eval("ThoiDiemLapDDH") %>' />
                </td>
                <td>
                    <asp:Label ID="TongTienLabel" runat="server" Text='<%# Eval("TongTien") %>' />
                </td>
                <td>
                    <asp:Label ID="TrangThaiLabel" runat="server" Text='<%# Eval("TrangThai") %>' />
                </td>
            </tr>
        </SelectedItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        No data was returned.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <EditItemTemplate>
            <tr style="background-color: #999999;">
                <td>
                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                        Text="Update" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Cancel" />
                </td>
                <td>
                    <asp:Label ID="IDDonDatHangLabel1" runat="server" 
                        Text='<%# Eval("IDDonDatHang") %>' />
                </td>
                <td>
                    <asp:TextBox ID="IDUserTextBox" runat="server" 
                        Text='<%# Bind("IDUser") %>' />
                </td>
                <td>
                    <asp:TextBox ID="ThoiDiemLapDDHTextBox" runat="server" 
                        Text='<%# Bind("ThoiDiemLapDDH") %>' />
                </td>
                <td>
                    <asp:TextBox ID="TongTienTextBox" runat="server" 
                        Text='<%# Bind("TongTien") %>' />
                </td>
                <td>
                    <asp:TextBox ID="TrangThaiTextBox" runat="server" 
                        Text='<%# Bind("TrangThai") %>' />
                </td>
            </tr>
        </EditItemTemplate>
        <ItemTemplate>
            <tr style="background-color: #E0FFFF;color: #333333;">
                <td>
                    <asp:Label ID="IDDonDatHangLabel" runat="server" 
                        Text='<%# Eval("IDDonDatHang") %>' />
                </td>
                <td>
                    <asp:Label ID="IDUserLabel" runat="server" 
                        Text='<%# Eval("IDUser") %>' />
                </td>
                <td>
                    <asp:Label ID="ThoiDiemLapDDHLabel" runat="server" 
                        Text='<%# Eval("ThoiDiemLapDDH") %>' />
                </td>
                <td>
                    <asp:Label ID="TongTienLabel" runat="server" Text='<%# format_tt(Eval("TongTien").ToString()) %>' />
                </td>
                <td>
                    <asp:Label ID="TrangThaiLabel" runat="server" Text='<%# format_text(Eval("TrangThai").ToString()) %>' />
                </td>
                  <td>
                    <a href="ChiTietDonDatHang.aspx?ma=<%# Eval("IDDonDatHang") %>" ><img src="images/edit.png" width="18px"/></a>
                </td>
            </tr>
        </ItemTemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="<%$ ConnectionStrings:ConnectionStringMembership %>" 
    SelectCommand="SELECT [IDDonDatHang], ( select UserName FROM [aspnet_Users] where [DonDatHang].ID_aspUser = [aspnet_Users].UserId ) as  [IDUser], [ThoiDiemLapDDH], [TongTien], [TrangThai] FROM [DonDatHang]"
    ></asp:SqlDataSource>
</asp:Content>

